package com.example.safehome;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.view.View;
import android.widget.Button;
import android.os.Bundle;

public class SensorChoosingActivity extends AppCompatActivity {

    private Button myBtnOne;
    private Button myBtnTwo;
    private Button myBtnThree;
    private Button myBtnFour;
    private Button myBtnFive;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.sensor_choosing_activity);

        myBtnOne = (Button) findViewById(R.id.btn_to_illegal_invasion);
        myBtnTwo = (Button) findViewById(R.id.btn_to_fire);
        myBtnThree = (Button) findViewById(R.id.btn_to_carbon);
        myBtnFour = (Button) findViewById(R.id.btn_to_water);
        myBtnFive = (Button) findViewById(R.id.btn_back_to_system_choosing);

        //按钮一是非法入侵检测器按钮
        myBtnOne.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(SensorChoosingActivity.this, BreakInSensorActivity.class);
                startActivity(intent);
            }
        } );

        //按钮二是火灾检测器按钮
        myBtnTwo.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(SensorChoosingActivity.this, FireSensorActivity.class);
                startActivity(intent);
            }
        } );

        //按钮三是一氧化碳检测器按钮
        myBtnThree.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(SensorChoosingActivity.this, CoDetectorActivity.class);
                startActivity(intent);
            }
        } );

        //按钮四是水位检测器按钮
        myBtnFour.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(SensorChoosingActivity.this, WaterSensorActivity.class);
                startActivity(intent);
            }
        } );

        //按钮五跳回到主系统选择界面
        myBtnFive.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(SensorChoosingActivity.this, SubSystemsChoosingActivity.class);
                startActivity(intent);
                finish();
            }
        });
    }
}


